# Base CUDA image 需要适配部署环境
# +dockerproxy镜像源
FROM docker.1panel.dev/pytorch/pytorch:2.4.1-cuda11.8-cudnn9-devel

# Install 3rd party apps
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt-get update && \
    apt-get install -y build-essential cmake && \
    apt-get install -y --no-install-recommends tzdata ffmpeg libsox-dev parallel aria2 git git-lfs && \
    git lfs install && \
    rm -rf /var/lib/apt/lists/*

# Copy only requirements.txt initially to leverage Docker cache
WORKDIR /workspace
COPY requirements_all.txt /workspace/
# +tsinghua镜像源，并删除缓存
RUN pip install --ignore-installed --no-deps --no-cache-dir -r requirements_all.txt -i https://pypi.tuna.tsinghua.edu.cn/simple && \
    rm -rf /tmp/* /root/.cache/pip

# Define a build-time argument for image type
ARG IMAGE_TYPE=full

# gpt-sovits-lite
LABEL maintainer="yangky02@mingyuanyun.com" version="dev-20241030" description="Docker image for GPT-SoVITS-lite Mingyuanyun Version"

# environment, set to oss
ENV MODEL_PATH="" \ 
    USER_PATH="" \ 
    ASR_PATH="" \
    PYTHONPATH="/workspace:/workspace/GPT_SoVITS"

# Copy the rest of the application
COPY . /workspace

EXPOSE 8000

ENTRYPOINT [ "python", "main.py" ]
